Ext.define('HelloWorld.view.Contact', {
        extend: 'Ext.form.Panel',
        xtype: 'helloworld_contact',
        requires:['Ext.form.FieldSet','Ext.form.Email'],
        config: {
                title: 'Contact',
                iconCls: 'user',
                items: [
                        {
                                xtype: 'fieldset',
                                title: 'Contact us',
                                instructions: '(email is not required)',
                                items: [
                                        {
                                                xtype: 'textfield',
                                                name: 'name',
                                                label: 'Name:'
                                        },
                                        {
                                                xtype: 'emailfield',
                                                name: 'email',
                                                label: 'Email'
                                        }, {
                                                xtype: 'textareafield',
                                                name: 'message',
                                                label: 'Message'
                                        }
                                ]
                        },{
                                xtype:'button',
                                text:'Submit',
                                ui:'confirm',
                                handler:function(){
                                        this.up('helloworld_contact').submit({
                                                method:'POST',
                                                url:'contact.php',
                                                waitMsg:'Waiting',
                                                params:{name:'henry liu',email:'liu_xuguang@hotmail.com',message:'Hello World'},
                                                success:function(form,result){
                                                         console.log('success:'+result);
                                                        console.log(result.responseText);
                                                },
                                                failure:function(form,result){
                                                        console.log(result.responseText);
                                                        //Ext.Msg.alert('failure');
                                                        var data = Ext.decode(result.responseText);
                                                        for(item in data){
                                                                console.log(item);
                                                        }
                                                }
                                                
                                        });
                                }
                        }
                ]
        }
});


